mui.init({
//	preloadPages:[{
//		id:'invest_record_page',
//		url:'../invest_record/invest_record.html'
//	}]
});
mui.plusReady(function(){
	loadDatas();
	
});

function loadDatas(){
	var self = plus.webview.currentWebview();
	var formId = self.formId;
	var sessionId =	plus.storage.getItem(KeyCfg.JSESSIONID);
	var url = UrlConfig.m_invite;
	//var formData = $("#myform").serialize();
	var formData = {sessionId:sessionId};
	MuiEventMgr.ajax(url,{pars:formData,
	  	sfn : function(data){
	  		callback(data);
	  	},ffn : function(err){
	  		mui.alert("获取数据失败：["+err+"]");
	  	}
	 });
}

function callback(data){
		//新增投资记录
		var count = data.count;
		var inviteLists = data.inviteList;
		var htmlArr = [];
		for(var i=0,len=inviteLists.length; i<len; i++){
	    	var inviteList = inviteLists[i];
	    	htmlArr[i] = getHtml(inviteList);
    	}
		var htmlStr = htmlArr.join(" ");
    	$("#item_loanRecords").html(htmlStr);

}

function getHtml(inviteList){
		var username = inviteList.username;
		var phone = inviteList.phone;
		var createTime = inviteList.createTime;
    		var htmlArr = [
			
			'	<div class="app_buyrecord_tab">',
			'		<div class="word" style="width: 30%;text-align: left;padding-left:25px">'+username+'</div>',
			'		<div class="word" style="width: 30%;text-align: right;padding-right:15px">'+phone+'</div>',
			'		<div class="word" style="width: 40%;">'+createTime+'</div>',
			'	</div>'
			
			];
		return htmlArr.join(" ");
}

